package com.tuo51.evaluate.domain.tags;

import com.tuo51.foudation.model.Model;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import java.io.Serializable;

@Entity
@Data
@Table(name = "m_tag", uniqueConstraints = {
        @UniqueConstraint( columnNames = {"title","month"})
})
public class Tag extends Model implements Serializable {
  private static final long serialVersionUID = 1L;

  @Column(columnDefinition = "varchar(128) COMMENT '标题'", nullable = false)
  private String title;

  @Column(columnDefinition = "int COMMENT '适用月龄'")
  private Integer month;

  @Column(columnDefinition = " bit DEFAULT 0 COMMENT '隐藏' ")
  private Boolean hidden = false;

  public static Tag of(String tagName, Integer month){
    Tag ret = new Tag();

    ret.setMonth(month);
    ret.setTitle(tagName);

    return ret;
  }

  public static Tag of(String tagName, Boolean hidden, Integer month){
    Tag ret = new Tag();

    ret.setHidden(hidden);
    ret.setMonth(month);
    ret.setTitle(tagName);

    return ret;
  }

}